package com.service.business.base.controller;

import com.service.business.base.controller.rep.BannerRep;
import com.service.business.base.service.BannerService;
import com.service.core.rest.BaseController;
import com.service.core.rest.response.MultiResponse;
import com.service.business.framework.log.RequestLog;
import com.service.dao.enums.BannerEnum;
import com.service.dao.model.Banner;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <dl>
 * <dt>platform</dt>
 * <dd>Description:</dd>
 * <dd>Copyright: Copyright (C) 2015</dd>
 * <dd>Company: </dd>
 * <dd>CreateDate: 2019年05月11日</dd>
 * </dl>
 *
 * @author
 */
@Slf4j
@RestController
@RequestMapping("/banner")
@Api(tags = "banner接口")
public class BannerController extends BaseController {

    @Autowired
    private BannerService bannerService;

    @RequestLog("获取首页banner")
    @ApiOperation("获取首页banner")
    @GetMapping("/home")
    public MultiResponse<BannerRep> getHomeBanner() {
        return successQueryMultiResponse(bannerService.listBannerByBizType(BannerEnum.BizType.home));
    }

    @RequestLog("获取礼包商城banner")
    @ApiOperation("获取礼包商城banner")
    @GetMapping("/gift-mall")
    public MultiResponse<BannerRep> getGiftMallBanner() {
        return successQueryMultiResponse(bannerService.listBannerByBizType(BannerEnum.BizType.gift_mall));
    }

    @RequestLog("获取积分商城banner")
    @ApiOperation("获取积分商城banner")
    @GetMapping("/points-mall")
    public MultiResponse<BannerRep> getPointsMallBanner() {
        return successQueryMultiResponse(bannerService.listBannerByBizType(BannerEnum.BizType.point_mall));
    }

    @RequestLog("获取算力商城banner")
    @ApiOperation("获取算力商城banner")
    @GetMapping("/hash-rate-mall")
    public MultiResponse<BannerRep> getHashRateMallBanner() {
        return successQueryMultiResponse(bannerService.listBannerByBizType(BannerEnum.BizType.hash_rate_mall));
    }


}
